/*
 * @Author: lbt666 '1319451895@qq.com'
 * @Date: 2022-07-19 14:39:51
 * @LastEditors: lbt666 1319451895@qq.com
 * @LastEditTime: 2023-05-12 18:21:09
 * @Description: 缓存合约数据
 */
import { defineStore } from 'pinia'
const contractStore = defineStore(
  'contract',
  {
    state: () => ({
      address: '',
      WEB3: null,
      contractInstance: null, // 合约
      token: null,
      nft: null,
      nonce: null, // 登录授权次数
      NetWork: true, // 请求状态
      BalanceFRM: 0,
      BalanceNFT: 0,
      empowerFRM: 0,
      empowerNFT: false
    }),
    actions: {
      SET_empowerFRM(payload: number) {
        this.empowerFRM = payload
      },
      SET_empowerNFT(payload: boolean) {
        this.empowerNFT = payload
      },
      SET_BalanceFrm(payload: number) {
        this.BalanceFRM = payload
      },
      SET_BalanceNFT(payload: number) {
        this.BalanceNFT = payload
      },
      SET_NetWork(payload: boolean) {
        this.NetWork = payload
      },
      SET_Address(payload: string) {
        this.address = payload
      },
      SET_WEB3(payload: any) {
        this.WEB3 = payload
      },
      SET_Contract(payload: any) {
        this.contractInstance = payload
      },
      SET_Nonce(payload: any) {
        this.nonce = payload
      },
      SET_ContractUSDT(payload: any) {
        this.token = payload
      },
      SET_ContractNFT(payload: any) {
        this.nft = payload
      }
    }
  })

export default contractStore
